home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 15
/
Aminet 15 - Nov 1996.iso
/
Aminet
/
dev
/
gcc
/
ixemsdk.lha
/
man
/
cat3
/
mpool.0
< prev
next >
Wrap
Text File
|
1996-09-02
|
7KB
|
199 lines
MPOOL(3) MPOOL(3)
NNAAMMEE
mpool - shared memory buffer pool
SSYYNNOOPPSSIISS
##iinncclluuddee <<ddbb..hh>>
##iinncclluuddee <<mmppooooll..hh>>
MMPPOOOOLL **
mmppooooll__ooppeenn ((DDBBTT **kkeeyy,, iinntt ffdd,, ppggnnoo__tt ppaaggeessiizzee,, ppggnnoo__tt mmaaxxccaacchhee));;
vvooiidd
mmppooooll__ffiilltteerr ((MMPPOOOOLL **mmpp,, vvooiidd ((**ppggiinn))((vvooiidd **,, ppggnnoo__tt,, vvooiidd **)),,
vvooiidd ((**ppggoouutt))((vvooiidd **,, ppggnnoo__tt,, vvooiidd **)),, vvooiidd **ppggccooookkiiee));;
vvooiidd **
mmppooooll__nneeww ((MMPPOOOOLL **mmpp,, ppggnnoo__tt **ppggnnooaaddddrr));;
vvooiidd **
mmppooooll__ggeett ((MMPPOOOOLL **mmpp,, ppggnnoo__tt ppggnnoo,, uu__iinntt ffllaaggss));;
iinntt
mmppooooll__ppuutt ((MMPPOOOOLL **mmpp,, vvooiidd **ppggaaddddrr,, uu__iinntt ffllaaggss));;
iinntt
mmppooooll__ssyynncc ((MMPPOOOOLL **mmpp));;
iinntt
mmppooooll__cclloossee ((MMPPOOOOLL **mmpp));;
DDEESSCCRRIIPPTTIIOONN
_M_p_o_o_l is the library interface intended to provide page
oriented buffer management of files. The buffers may be
shared between processes.
The function _m_p_o_o_l___o_p_e_n initializes a memory pool. The
_k_e_y argument is the byte string used to negotiate between
multiple processes wishing to share buffers. If the file
buffers are mapped in shared memory, all processes using
the same key will share the buffers. If _k_e_y is NULL, the
buffers are mapped into private memory. The _f_d argument
is a file descriptor for the underlying file, which must
be seekable. If _k_e_y is non-NULL and matches a file
already being mapped, the _f_d argument is ignored.
The _p_a_g_e_s_i_z_e argument is the size, in bytes, of the pages
into which the file is broken up. The _m_a_x_c_a_c_h_e argument
is the maximum number of pages from the underlying file to
cache at any one time. This value is not relative to the
number of processes which share a file's buffers, but will
be the largest value specified by any of the processes
sharing the file.
The _m_p_o_o_l___f_i_l_t_e_r function is intended to make transparent
input and output processing of the pages possible. If the
June 4, 1993 1
MPOOL(3) MPOOL(3)
_p_g_i_n function is specified, it is called each time a
buffer is read into the memory pool from the backing file.
If the _p_g_o_u_t function is specified, it is called each time
a buffer is written into the backing file. Both functions
are are called with the _p_g_c_o_o_k_i_e pointer, the page number
and a pointer to the page to being read or written.
The function _m_p_o_o_l___n_e_w takes an MPOOL pointer and an
address as arguments. If a new page can be allocated, a
pointer to the page is returned and the page number is
stored into the _p_g_n_o_a_d_d_r address. Otherwise, NULL is
returned and errno is set.
The function _m_p_o_o_l___g_e_t takes a MPOOL pointer and a page
number as arguments. If the page exists, a pointer to the
page is returned. Otherwise, NULL is returned and errno
is set. The flags parameter is not currently used.
The function _m_p_o_o_l___p_u_t unpins the page referenced by
_p_g_a_d_d_r. _P_g_a_d_d_r must be an address previously returned by
_m_p_o_o_l___g_e_t or _m_p_o_o_l___n_e_w. The flag value is specified by
_o_r'ing any of the following values:
MPOOL_DIRTY
The page has been modified and needs to be written
to the backing file.
_M_p_o_o_l___p_u_t returns 0 on success and -1 if an error occurs.
The function _m_p_o_o_l___s_y_n_c writes all modified pages associ-
ated with the MPOOL pointer to the backing file.
_M_p_o_o_l___s_y_n_c returns 0 on success and -1 if an error occurs.
The _m_p_o_o_l___c_l_o_s_e function free's up any allocated memory
associated with the memory pool cookie. Modified pages
are nnoott written to the backing file. _M_p_o_o_l___c_l_o_s_e returns
0 on success and -1 if an error occurs.
EERRRROORRSS
The _m_p_o_o_l___o_p_e_n function may fail and set _e_r_r_n_o for any of
the errors specified for the library routine _m_a_l_l_o_c(3).
The _m_p_o_o_l___g_e_t function may fail and set _e_r_r_n_o for the fol-
lowing:
[EINVAL] The requested record doesn't exist.
The _m_p_o_o_l___n_e_w and _m_p_o_o_l___g_e_t functions may fail and set
_e_r_r_n_o for any of the errors specified for the library rou-
tines _r_e_a_d(2)_, _w_r_i_t_e(2)_, and _m_a_l_l_o_c(3).
The _m_p_o_o_l___s_y_n_c function may fail and set _e_r_r_n_o for any of
the errors specified for the library routine _w_r_i_t_e(2).
June 4, 1993 2
MPOOL(3) MPOOL(3)
The _m_p_o_o_l___c_l_o_s_e function may fail and set _e_r_r_n_o for any of
the errors specified for the library routine _f_r_e_e(3).
SSEEEE AALLSSOO
_d_b_o_p_e_n(3), _b_t_r_e_e(3), _h_a_s_h(3), _r_e_c_n_o(3)
June 4, 1993 3